from threading import Thread
import time


def task(i):
    num = 0
    print(f'\n子线程--执行函数fun{i}')
    time.sleep(2)
    while num < 30010000:
        num += 1


if __name__ == '__main__':
    t1 = time.time()
    list_t = list()
    for j in range(2):
        t = Thread(target=task, args=(j,))
        list_t.append(t)
        t.start()
    for t in list_t:
        t.join()
    print('主线程')
    t2 = time.time()
    print('cost:', t2 - t1)
